package com.meixiang.activity.homes.financial;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.meixiang.R;
import com.meixiang.activity.homes.staging.RepaymentSuccessActivity;
import com.meixiang.dialog.TradersPasswordtKeyDialog;
import com.meixiang.main.BaseActivity;
import com.meixiang.view.ClearEditText;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * @author yinsujun  Created at 2016/5/3 19:57
 *         确认投资
 */
public class ConfirmInvestmentActivity extends BaseActivity {
    @Bind(R.id.confirm_investment_tv_balance)
    TextView tvBalance;
    @Bind(R.id.confirm_investment_tv_earnings)
    TextView tvEarnings;
    @Bind(R.id.confirm_investment_tv_apr)
    TextView tvApr;
    @Bind(R.id.confirm_investment_tv_limit)
    TextView tvLimit;
    @Bind(R.id.confirm_investment_tv_time)
    TextView tvTime;
    @Bind(R.id.confirm_investment_tv_remaining)
    TextView tvRemaining;
    @Bind(R.id.confirm_investment_tv_remaining_money)
    TextView tvRemainingMoney;
    @Bind(R.id.confirm_investment_et)
    ClearEditText confirmInvestmentEt;
    @Bind(R.id.confirm_investment_bt)
    Button btConfirm;
    @Bind(R.id.confirm_investment_linear_info)
    LinearLayout confirmInvestmentLinearInfo;
    private  TradersPasswordtKeyDialog dialog;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        setContentView(R.layout.activity_confirm_investment);
        ButterKnife.bind(this);
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void initTitle() {
        setTitle("美金融");

    }

    @Override
    protected void initView() {


    }

    @Override
    protected void setData() {

    }

    private boolean isClick = false;

    @OnClick({R.id.confirm_investment_bt})
    void click(View view) {
        if (view.equals(btConfirm)) {
            if (isClick == false) {
                isClick = true;
                dialog=new TradersPasswordtKeyDialog(this,"理财投资","0.00", new TradersPasswordtKeyDialog.OnCustomDialogListener() {
                    @Override
                    public void getPayPassWord(TradersPasswordtKeyDialog paymentKeyDialog, String password) {
                        Intent intent=new Intent(context,InvestmentSuccessActivity.class);
                        startActivity(intent);
                    }
                });
//                passwordDialog.showDialog("理财投资","￥0.00","忘记交易密码?");
            } else {
                isClick = false;
                if(dialog!=null&&dialog.isShowing()){

                    dialog.dismiss();
                }
            }
        }
    }

    @Override
    public void onClick(View v) {

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
//        if (passwordDialog != null && passwordDialog.isShowing()) {
//            passwordDialog.dismiss();
//        }
    }

//    @Override
//    public void getPaymentPassword(String password) {
////        Tool.showTextToast(context, password);
//        Log.e(TAG,"交易密码====="+password);
//        Intent intent=new Intent(context,InvestmentSuccessActivity.class);
//        startActivity(intent);
//    }

}
